<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use App\Models\Usersauthority;
use App\Services\CacheService;
use App\Services\Qrcodedecoder;
use DB,Log,Exception;

class Allqrcodedecoder extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'qrcodes:decoder';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '二维码解码';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        DB::table("links_lists_qrcodes")->select("id","img_url")->where("id","<",50)->orderBy('id')->chunk(100, function ($qrcodes) {
            foreach ($qrcodes as $qrcode) {
                $qrcode_link = Qrcodedecoder::qrcodeDecoder($qrcode->img_url);
                dump($qrcode_link);
            }
        });
    }
}
